package com.summer.safe.config.result;

/**
 * Description:接口返回码和返回值
 * 结合返回数据封装类ResultWrapperEntity，统一接口的数据返回格式
 */
public enum ResultCode {

    SUCCESS("0", "成功"),

    LOGIN_SUCCESS("0", "登录成功"),
    SUCCESS_QUERY("0", "查询成功"),
    SUCCESS_SAVE("0", "保存成功"),
    GENERATE_SAVE("0", "代码生成完成"),
    SUCCESS_DELETE("0", "删除成功"),
    CLEARCACHE("0", "服务端清理缓存成功"),


    FAIL_QUERY("1", "查询失败"),
    FAIL_SAVE("1", "保存失败"),
    FAIL_DELETE("1", "删除失败"),
    FAIL_GENERATE("1", "代码生成失败"),

    UNKNOWN_ERROR("007","未知错误"),

    UNAUTHORIZED("0003", "无访问权限"),


    SUCCESS_NO_DATA("0002", "查询成功无记录"),

    ACCOUNT_ERROR("1000", "账户不存在或被禁用"),

    //业务错误码 1000-99999
    API_NOT_EXISTS("1001", "请求的接口不存在"),
    API_NOT_PER("1002", "没有该接口的访问权限"),
    PARAMS_ERROR("1004", "参数为空或格式错误"),
    SIGN_ERROR("1005", "数据签名错误"),
    API_DISABLE("1011", "查询权限已被限制"),
    UNKNOWN_IP("1099", "非法IP请求"),
    SYSTEM_ERROR("9999", "系统异常"),

    DEMONSTRATION_ERROR("35051", "演示模式不允许提交"),
    REPEAT_SUBMIT("35052", "数据已经提交,禁止重复提交"),
    REPEAT_SUBMIT_ERROR("35053", "验证重复提交时出现未知异常"),

    USER_ERROR("10000","用户已存在"),
    DEPT_ERROR("10000","部门已存在"),
    ROLE_ERROR("10000","角色已存在"),
    MENU_ERROR("10000","菜单已存在"),
    MODULE_ERROR("10000","模块已存在"),
    DICT_TYPE_ERROR("10000","字典类型已存在"),

    DEMO_MODE_ERROR("10002","演示模式,禁止提交");


    /**
     * 错误代码
     */
    private String code;
    /**
     * 错误信息
     */
    private String msg;

    public String getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    ResultCode(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

}
